1. Field of the Invention
The present invention relates to image data compression apparatuses and, more specifically, to an image data compression apparatus capable of reducing false color in image data to a minimum when image compression or decompression is performed.
2. Description of the Related Art
Recently, an apparatus such as a digital still camera has become increasingly popular. The digital still camera performs image compression for an image pick up signal, which has been obtained by image pick up and digitalized as image data, and stores it in a flash memory.
An image pick up portion of such digital still camera corresponds to a CCD (Charge Coupled Device) imager to which a primary color filter 30 is mounted including color filters of three primary colors, R (Red), G (Green) and B (Blue), arranged in a mosaic like pattern as shown in FIG. 2. The image data obtained through the CCD imager and corresponding to one image plane is stored in a DRAM (Dynamic Random Access Memory). Thus, the image data stored in the DRAM includes, for a pixel to which one of the R, G and B filters is mounted, only the image data corresponding to that color of the filter, but not the image data corresponding to other two colors. Accordingly, the image data corresponding to other two colors are obtained by interpolation using surrounding pixel values.
Prescribed image compression is performed for the image data after the interpolation, and the image data is stored in the flash memory or the like.
However, the R, G and B filters have different filter characteristics. As a result, in the case of such single plate color digital still camera, in a portion of the image data which should have an uniform color, a different color (which is referred to as a xe2x80x9cfalse colorxe2x80x9d throughout the specification) appears. A similar problem arises at the edge of the image data. In addition, the R, G and B filters also have different filter characteristics in a three plate color digital still camera. Thus, the false color is similarly generated.
When the image data is stored in the flash memory as a file, it is in most cases handled as a file of a prescribed size for facilitating data handling. Thus, the data is compressed at a suitable compression ratio to effectively utilize a memory region.
When an image compression or decompression processing is performed for the image data at a high compression ratio, an effect of eliminating a high frequency component is provided, so that information in the detail of the image data is lost. In this case, however, the false color is not readily generated. On the other hand, when the image compression or decompression processing is performed at a low compression ratio, information in the detail of the image data is not easily lost. In this case, however, the false color may easily be generated. When image compression is performed at the low compression ratio, a high image quality is generally required. Therefore, the generation of the false color is a serious problem to be solved.
The present invention is made to solve the aforementioned problem. It is an object of the present invention to provide an image data compression apparatus capable of reducing false color in image data to a minimum when image compression or decompression is performed.
Another object of the present invention is to provide an image data compression apparatus capable of reducing false color in image data to a minimum when image compression or decompression is performed at a low compression ratio.
An image data compression apparatus according to an aspect of the present invention includes: a preliminary image compressing portion compressing image data in a sampling region which has been set in a specific position on an image plane for obtaining preliminary compressed image data; a data size evaluation value calculating portion connected to the preliminary image compressing portion and calculating a data size evaluation value from a data length of the preliminary compressed image data; a compression ratio determining portion connected to the data size evaluation value calculating portion and determining compression ratios of image data to color data and luminance data such that a data size of the compressed image when image compression is performed for the entire image plane of the image data equals to a prescribed desired data size and such that the compression ratio of the image data to the color data equals to or exceeds the compression ratio of the image data to the luminance data; and an image compressing portion connected to the compression ratio determining portion and performing image compression for the entire image plane of the image data in accordance with the compression ratios of the image data to the color and luminance data.
The compression ratio determining portion sets the compression ratios such that the compression ratio of the. image data to the color data is higher than the compression ratio of the image data to the luminance data. Thereby, a high frequency component against the color data is eliminated and generation of a false color in the image data is prevented when an image compression or decompression processing is performed.
Preferably, the compression ratio determining portion includes: a compression ratio predicting portion connected to the data size evaluation value calculating portion and predicting a compression ratio which allows the data size of the compressed image when image compression is performed for the entire image plane of the image data to be equal to the prescribed desired data size in accordance with the data size evaluation value; and a compression ratio adjusting portion connected to the compression ratio predicting portion and setting values which are obtained by increasing and decreasing the compression ratio as the compression ratios of the image data to the color and luminance data, respectively.
The compression ratio adjusting portion sets the compression ratio of the image data to the color data such that it is higher than the compression ratio of the image data to the luminance data. Thereby, the high frequency component against the color data is eliminated and generation of the false color in the image data is prevented when image compression or decompression is performed. More preferably, the image data compression apparatus further includes an image compression mode setting portion setting an image compression mode corresponding to the prescribed desired data size. The compression ratio adjusting portion includes a portion for setting the compression ratios of the image data to the color and luminance data by adding and subtracting first and second values determined in accordance with the prescribed desired data size to and from the compression ratio, respectively.
The larger the desired data size is, the lower the compression ratio obtained from the compression ratio predicting portion is. The lower the compression ratio obtained from the compression ratio predicting portion is, the more the compression ratio adjusting portion increases the value of the compression ratio for setting it as the compression ratio of the image data to the color data. Thus, the compression ratio of the image data to the color data is always set at a high value. Thereby, the high frequency component against the color data is eliminated and generation of the false color in the image data is prevented when image compression or decompression is performed.
A method of compressing image data according to another aspect of the present invention includes steps of: compressing image data in a sampling region which has been set in a specific position on an image plane for obtaining a preliminary compressed image data and calculating a data size evaluation value from a data length of the preliminary compressed image data; determining compression ratios of the image data to color and luminance data in accordance with the data size evaluation value such that a data size of the compressed image when image compression is performed for the entire image plane of the image data equals to a prescribed desired data size and such that the compression ratio of the image data to the color data equals to or exceeds the compression ratio of the image data to the luminance data; and performing image compression for the entire image plane of the image data in accordance with the compression ratios of the image data to the color and luminance data.
In the step of determining the compression ratio, the compression ratio of the image data to the color data is set such that it is higher than the compression ratio of the image data to the luminance data. Thereby, a high frequency component against the color data is eliminated and generation of a false color in the image data is prevented when image compression or decompression is performed.
A digital camera according to still another aspect of the present invention includes: an imager receiving a video signal; an A/D converter digitizing the video signal output from the imager and converting it to image data; a storage device storing the image data; a preliminary image compressing portion compressing the image data in a sampling region which has been set in a specific position on an image plane for obtaining preliminary compressed image data; a data size evaluation value calculating portion connected to the preliminary image compressing portion and calculating a data size evaluation value from a data length of the preliminary compressed image data; a compression ratio determining portion connected to the data size evaluation value calculating portion and determining compression ratios of the image data to color and luminance data in accordance with the data size evaluation value such that a data size of the compressed image when image compression is performed for the entire image plane of the image data equals to a prescribed desired data size and such that the compression ratio of the image data to the color data equals to or exceeds the compression ratio of the image data to the luminance data; and an image compressing portion connected to the compression ratio determining portion and performing image compression for the entire image plane of the image data in accordance with the compression ratios of the image data to the color and luminance data.
The compression ratio determining portion sets the compression ratio of the image data to the color data such that it is higher than the compression ratio of the image data to the luminance data. Thereby, a high frequency component against the color data is eliminated and generation of a false color of the image data is prevented when image compression or decompression is performed.